<template>
    <div class="big-box">
        <div class="header">
            <img src="../../../../../assets/bigScreen/header1.png" alt="" />
            <div class="backBox" @click="goBack"></div>
        </div>
        <div class="backToBox">
            <div class="backTo" @click="gotoHome">
                <div>返回总窗口</div>
            </div>
            <div class="backTo" @click="backToOne">
                <div>返回上一页</div>
            </div>
        </div>
        <div class="centerBox">
            <div class="sreenTitle">科技研发需求</div>
            <div class="center" v-if="detail">
                <div class="top" id="title">
                    <div class="top-content">
                        <div class="top-content-title">{{ detail.name }}</div>
                        <div class="top-content-info">
                            <div style="word-break: break-all;">单位名称： {{detail.dept}}</div>
                            <div v-if="detail.area">地区： {{ detail.province + detail.city + detail.area }}</div>
                            <div>发布时间： {{ detail.createTime }}</div>
                            <!-- <div>来源: 试点城市（园区）</div> -->

                        </div>
                        <div class="top-content-info" style="margin-top: 1.5rem;">
                            <div>截止日期： {{ detail.publicityDeadline||'--' }}</div>
                            <div class="text-align: center;">
                                <div v-if="detail.consultStatus&&detail.budgetAmount">价格:
                                {{ detail.consultStatus.value == '0' ? detail.budgetAmount + '万元' : '双方协商' }}
                            </div>
                            </div>
                            <div style="word-break: break-all;">联系方式： {{detail.phone}}</div>
                        </div>
                    </div>
                </div>
                <div class="add-box" style="margin-top:2rem" id="title1">
                    <div class="add-title">行业领域</div>
                </div>
                <div class="text-box">{{ detail.industrySectorName }}</div>
                <div class="add-box" id="title2">
                    <div class="add-title">需求背景</div>
                </div>
                <div class="text-box">{{ detail.describes || '暂无' }}</div>
                <div class="add-box" id="title3">
                    <div class="add-title">需解决的主要技术难题</div>
                </div>
                <div class="text-box">{{ detail.technicalChallenges || '暂无' }}</div>
                <div class="add-box" id="title4">
                    <div class="add-title">期望实现的主要技术目标</div>
                </div>
                <div class="text-box">{{ detail.technicalObjectives || '暂无' }}</div>
            </div>
        </div>
    </div>
</template>

<script>
import {
    putOrgExpert
} from "../../../../../api/globalSearch"
import {
    getDemandTechnologyDetail,
    addPhone
} from "../../../../../api/technology.js"
import {
    reactive,
    ref,
    toRaw,
    shallowRef
} from "vue"
import {
    message
} from "ant-design-vue"
export default {
    components: {
    },
    data() {
        return {
            wrapperStyle: {
                minWidth: '20rem'
            },
            list: [],
            orgList: [],
            perList: [],
            tabAct: 0,
            detail: undefined,
            form: {
                phone: ''
            },
            labelCol: {
                span: 4
            },
            wrapperCol: {
                span: 14
            },
            rules: {
                name: [{
                    required: true,
                    message: '请输入姓名',
                    trigger: 'blur'
                }],
                phone: [{
                    required: true,
                    message: '请输入手机号码',
                    trigger: 'blur'
                }],
                deptName: [{
                    required: true,
                    message: '请输入单位名称',
                    trigger: 'blur'
                }],
                remark: [{
                    required: true,
                    message: '请输入备注',
                    trigger: 'blur'
                }],
            }
        }
    },
    mounted() {
        this.getDetail(this.$route.query.id)
    },
    methods: {
        // 阻止点击的默认事件修改路由
        handleAnchorClick(e, link) {
            e.preventDefault();
            var srcolls = document.getElementById(link.href);
            srcolls.scrollIntoView({
                block: 'start',
                behavior: 'smooth'
            });
        },
        toDetail(item, type) {
            console.log(item.id);
            var url = '';
            if (type == 1) { //科研机构
                url = '/scientificOrgDetail'
            }
            // if (type == 3) {
            // url = '/scientificOrgDetail'
            // }
            if (type == 2) { //科研人才
                url = '/scientificPersonDetail'
            }
            this.$router.push({
                path: url,
                query: {
                    id: item.id
                }
            })
        },
        getMatch() {
            // console.log(item.id);
            putOrgExpert({
                industryId: this.detail.industrySectorId
            }).then((response) => {
                this.list.value = [];
                if (response.code == 200) {
                    this.list = response.data;
                    // this.list.map(v => {
                    // if (v.type == 1) {
                    this.orgList = response.data.researchOrganizationList
                    // } else {
                    this.perList = response.data.personnelList
                    // }
                    // })
                } else {
                    this.list = []
                }
            }).catch(err => {
                this.list = []
            })
        },
        getDetail(id) {
            console.log('112');
            getDemandTechnologyDetail(id).then(res => {
                if (res.code == 200) {
                    this.detail = res.data
                    this.getMatch();
                }
            })
        },
        submit() {
            let data = toRaw(this.form)
            data.type = '0'
            data.demandId = this.detail.id
            data.publisher = this.detail.dept
            data.title = this.detail.name
            let phoneReg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
            if (data.phone != '') {
                if (!(phoneReg.test(data.phone))) {
                    message.info('请输入正确的手机号')
                    return false
                }
            }
            addPhone(data).then(res => {
                if (res.code == 200) {
                    message.success('新增成功')
                    this.$router.go(-1)
                }
            })
        },
        gotoHome() {
            this.$router.push({
                path: '/bigScreenIndex',
            })
        },
        backToOne() {
            console.log('11');
            this.$router.go(-1)
        },
        goBack() {
            this.$router.push('/chart')
        }
    }
}
</script>

<style scoped lang="scss">
@font-face {
    font-family: "ffa";
    src: url(../../../assets/bigScreen/fonts/DS-DIGIB.TTF);
}
ul,
li {
    list-style: none;
}
.big-box {
    background-color: #071c3b;
    height: 100vh;
}
.header {
    position: relative;
    text-align: center;
    position: relative;
    height: 19.1rem;

    .backBox {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 70rem;
        height: 10rem;
        cursor: pointer;
    }

    > img {
        width: 100%;
        max-height: 100%;
        margin-top: -1.1rem;
        image-rendering: -moz-crisp-edges; /* Firefox */
        image-rendering: -o-crisp-edges; /* Opera */
        image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming) */
        image-rendering: crisp-edges;
        -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
    }
}
.centerBox {
    width: 96%;
    margin: 0 auto;
    position: absolute;
    top: 14rem;
    left: 2%;
    .sreenTitle {
        background-image: url("../../../../../assets/bigScreen/sreenTitle.png");
        background-size: 100% 100%;
        height: 3.8rem;
        padding-left: 35px;
        font-weight: 600;
        color: #fff;
        display: flex;
        align-items: center;
    }
    .center {
        margin-top: 1rem;
        height: calc(100vh - 20rem);
        border: 1px solid;
        border-image: linear-gradient(
                130deg,
                #2385df 0%,
                rgba(35, 133, 223, 0.65) 92%
            )
            1;
        overflow-y: scroll;
        padding: 20px;
        .top {
            width: 100%;
            // height: 24rem;
            background-size: 100% 100%;

            .top-content {
                width: 136rem;
                text-align: center;
                padding: 6rem 0;
                margin: 0 auto;

                .top-content-title {
                    font-size: 3.2rem;
                    color: #fff;
                }

                .top-content-info {
                    display: flex;
                    justify-content: space-between;
                    font-size: 1.6rem;
                    color: #d4d4d4;
                    margin-top: 4rem;
                    div:nth-child(1){
                        width: 33%;
                        text-align: left;
                    }
                    div:nth-child(2){
                        width: 33%;
                        text-align: center;
                    }
                    div:nth-child(3){
                        width: 33%;
                        text-align: right;
                    }
                }
            }
        }
        .add-box {
            width: 136rem;
            height: 6.5rem;
            margin: 0 auto;
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 1px solid #4494ff46;

            .add-title {
                display: flex;
                align-items: center;
                font-size: 2.2rem;
                font-weight: bold;
                color: #1F75C7;

                &::before {
                    content: "";
                    display: block;
                    width: 0.5rem;
                    height: 3rem;
                    background: #037aff;
                    margin-right: 1rem;
                }
            }

            .add-btn {
                width: 13rem;
                height: 4.5rem;
                text-align: center;
                line-height: calc(4.5rem - 4px);
                border-radius: 4px;
                border: 1px solid #037aff;
                font-size: 1.6rem;
                color: #037aff;
                cursor: pointer;
            }
        }

        .text-box {
            width: 136rem;
            padding: 2rem 0 4rem 0;
            margin: 0 auto;
            color: rgba(216, 216, 216, 0.85);
            font-size: 1.8rem;
            word-break: break-all;
        }
    }
    ::-webkit-scrollbar {
        width: 5px;
        height: 10px;
    }

    /* 滚动条轨道 */
    ::-webkit-scrollbar-track {
        background-color: #234470;
    }

    /* 滚动条滑块 */
    ::-webkit-scrollbar-thumb {
        background-color: #061c57;
    }

    /* 鼠标悬停在滚动条上的滑块 */
    ::-webkit-scrollbar-thumb:hover {
        background-color: #555;
    }
}
.backToBox {
    position: absolute;
    top: 8rem;
    right: 2%;
    display: flex;
    z-index: 10;
    .backTo {
        background-image: url("../../../../../assets/bigScreen/backTo.png");
        color: #2dccff;
        background-size: 100% 100%;
        width: fit-content;
        padding: 2px 40px 10px 10px;
        font-weight: 600;
        cursor: pointer;
        margin-left: 10px;
        div {
            padding-top: 5px;
        }
    }
}
</style>
